home *** CD-ROM | disk | FTP | other *** search
-
- typedef int Truth;
- const int TRUE = 1;
- const int FALSE = 0;
- const int size = 100; // constant integer, kind of like a macro
-
- class Stack { // Stack of integers
- public: // these members are public
- Stack() { sp = 0; }
- void push( int x) { elt[sp++] = x; }
- int pop() { return elt[--sp]; }
- Truth isempty() { return sp <= 0; }
- Truth isfull() { return sp >= size; }
- private: // these (data) members are private
- int sp; // sp 'points' to next available slot
- int elt[size];
- };
-
-